const mongoose = require('mongoose')

// 英雄模型
const schema = new mongoose.Schema({

    // 英雄名字、头像、称号、海报
    name: { type: String },
    avatar: { type: String },
    title: { type: String },
    poster: { type: String },
    // 英雄定位
    position: [{
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'Category' }],

    // 难度、物理、魔法、防御系数
    coefficient: {
        physical: { type: Number },
        magic: { type: Number },
        defense: { type: Number },
        difficult: { type: Number }

    },

    // 技能
    skills: [{
        icon: { type: String },
        name: { type: String },
        introduce: { type: String },
        tips: { type: String }
    }],

    // 优势、劣势出装
    advantages_equip: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Equip' }],
    disadvantages_equip: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Equip' }],

    // 使用、对线、团战技巧
    use_tips: { type: String },
    battle_tips: { type: String },
    team_tips: { type: String },

    // 搭档和天敌
    partner: [{
        hero: { type: mongoose.SchemaTypes.ObjectId, ref: 'Hero' },
        description: { type: String }
    }],
    enemy: [{
        hero: { type: mongoose.SchemaTypes.ObjectId, ref: 'Hero' },
        description: { type: String }
    }],
})

module.exports = mongoose.model('Hero', schema, `heroes`)
